/*
 * FaceAnalyzer.h
 *
 *  Created on: 2018年9月4日
 *      Author: zhengboyuan
 */

#ifndef FACEANALYZER_H_
#define FACEANALYZER_H_

#include "LibMediaDecoder.h"
#include <string>


class FaceAnalyzerSink
{
public:
	virtual ~FaceAnalyzerSink() {}

	virtual void onFace(const std::string& text, int64_t pts) = 0;
};


class FaceAnalyzer
{
public:
	
public:
	FaceAnalyzer();
	virtual ~FaceAnalyzer();

	bool open(const MDecode_Format& fmt);
	void close();

	void input(int mediaType, const uint8_t* buffer, int length, int64_t pts, int flags);

	void setSink(FaceAnalyzerSink* sink);

protected:
	static void decodeCallback(HANDLE handle, MDecode_Frame* frame, void* pUser);
	void onDecodeFrame(HANDLE handle, MDecode_Frame* frame);

	std::string makeFaceTrack(int64_t pts);

protected:
	HANDLE	m_handle;
	FaceAnalyzerSink*	m_sink;

	int m_frameCount;

};

#endif /* FACEANALYZER_H_ */
